<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <f:view>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Carga Pacientes</title>
            <!--<link type="text/css" href="../common/css/redmond/jquery-ui-1.8.23.custom.css" rel="stylesheet" />-->
            <link type="text/css" href="../common/css/redmond/jquery-ui-1.8.23.custom.css" rel="stylesheet" />
            <link type="text/css" href="../common/css/administrar.css" rel="stylesheet" />
            <script type="text/javascript" src="../common/js/jquery-1.8.0.min.js"></script>
            <script type="text/javascript" src="../common/js/jquery-ui-1.8.23.custom.min.js"></script>
            <!--<script type="text/javascript" src="../common/js/jquery-1.4.2.min.js"></script>-->
            <!--<script type="text/javascript" src="../common/js/jquery.ui.all.js"></script>-->
            <!--<script type="text/javascript" src="../common/js/jquery.layout.js"></script>-->
            <!--<script type="text/javascript" src="../common/js/jquery-ui-1.8.6.custom.min.js"></script>-->
            <script type="text/javascript" src="../common/js/calendarioui-es.js"></script>
            <script type="text/javascript" src="../common/js/jquery.dateentry.js"></script>
            <script type="text/javascript" src="../common/js/carga_masiva.js"></script>
            <script type="text/javascript" src="../common/js/jquery.tablesorter.min.js"></script>
            <script type="text/javascript" src="../common/js/jquery.metadata.js"></script>
            <script type="text/javascript" src="../common/js/jquery.tablesorter.pager.js"></script>
            <script type="text/javascript" src="../common/js/jquery.validate.js"></script>
            <script src="../common/js/jquery.fileupload.js" type="text/javascript"></script>
            <script src="../common/js/jquery.fileupload-ui.js" type="text/javascript"></script>

            <style type="text/css" title="currentStyle">			
                @import "../common/css/jquery.fileupload-ui.css";
            </style>
        </head>
        <body>
            <br />
            <br />
            <br />
            <br />
            <center>
                <iframe id="uploadFrame" name="uploadFrame" height="0" width="0" frameborder="0" scrolling="yes"></iframe>

                <form id="file_upload" action="/salus/CargaPlanosServlet" method="POST" enctype="multipart/form-data">
                    <input type="file" name="file" multiple="true"/>
                    <button>Upload</button>
                    <div>Cargar Planos</div>               
                </form>
                <table id="files"></table>
            </center>

            <script>
                /*global $ */
                $(function () {
                    $('#file_upload').fileUploadUI({
                        uploadTable: $('#files'),
                        downloadTable: $('#files'),
                        buildUploadRow: function (files, index) {
                            return $('<tr><td>' + files[index].name + '</td>' +
                                '<td class="file_upload_progress"><div></div></td>' +
                                '<td class="file_upload_cancel">' +
                                '<button class="ui-state-default ui-corner-all" title="Cancel">' +
                                '<span class="ui-icon ui-icon-cancel">Cancel</span>' +
                                '</button></td></tr>');
                        },
                        buildDownloadRow: function (file) {
                        
                            if(file.errores=='0'){
                                return $('<tr class="ui-widget-content"><td>' + file.name + '&nbsp;&nbsp;<img src="../common/img/passed_.gif" /></td></tr>');
                            }else{
                                return $('<tr class="ui-widget-content"><td>' + file.name + '&nbsp;&nbsp;<a href="javascript:verErrores(\''+file.name+'\',\''+file.errores+'\')"><img src="../common/img/error.gif" /></a></td></tr>');
                            }                                                
                        }
                    });
                });
            </script>
        </body>
    </f:view>
</html>
